
*Replication commands for Erosion of Civilian Control in Democracies: A Comprehensive Framework for Comparative Analysis
xtset ccode year

* The effect of intrastate conflict on the likelihood of coup attempts (Table 5)
xtlogit coup_sys i.conflicttype c.v2x_polyarchy external_conflict ln_gdppc ln_population durable coldwar ten_years,or vce (cluster ccode)

* The effect of intrastate conflict on erosion by deference and competition (Table 6)
xtreg actmilcabshare c.v2x_polyarchy##i.conflicttype external_conflict ln_gdppc ln_population coldwar coup_takeover coup_attempt ten_years dur, fe vce (cluster ccode)

* Robustness check for hypothesis testing: Using 1-year lag in intrastate conflict (Appendix 1)
xtreg actmilcabshare c.v2x_polyarchy##i.lag_conflicttype i.conflicttype external_conflict ln_gdppc ln_population coldwar coup_takeover coup_attempt ten_years dur, fe vce (cluster ccode)

* Robustness check for hypothesis testing: Running the model on a sample of democracies only (Appendix 2, Model 1) 
xtreg actmilcabshare  i.conflicttype external_conflict ln_gdppc ln_population coldwar coup_takeover coup_attempt ten_years dur if v2x_polyarchy>=0.75, fe vce (cluster ccode)

* Robustness check for hypothesis testing: Running the model on a sample of democracies only controlling for the type of the system of government (Appendix 2, Model 2)
xtreg actmilcabshare  i.conflicttype external_conflict ln_gdppc ln_population coldwar coup_takeover coup_attempt ten_years dur b5.gov_syst if v2x_polyarchy>=0.75, fe vce (cluster ccode)
